<template>
    <div>
        <h1>修改页面</h1>
        <table>
            <tr>
                <td>房屋名称</td>
                <td><input type="text" v-model="dataa.hourseName"></td>
            </tr>
            <tr>
                <td>房屋面积</td>
                <td><input type="text" v-model="dataa.hourseNumber"></td>
            </tr>
            <tr>
                <td>房屋状态</td>
                <td>
                    <input type="radio" name="1" :value=1 v-model="dataa.hourseStart">正常
                    <input type="radio" name="1" :value=2 v-model="dataa.hourseStart">冻结
                </td>
            </tr>
            <tr>
                <td>选择用户</td>
                <td>
                     <input type="radio" name="userId" :value=1 v-model="dataa.userId">甄子恒
                     <input type="radio" name="userId" :value=2 v-model="dataa.userId">111
                     <input type="radio" name="userId" :value=3 v-model="dataa.userId">1234
                </td>
            </tr>
            <tr>
                <td></td>
                <td><input type="button" value="修改" @click="update"></td>
            </tr>
        </table>
    </div>
</template>
<script setup lang="ts">
import axios from 'axios';
import {ref,onMounted} from 'vue';
import {useRouter,useRoute} from 'vue-router';
const router = useRouter()
const route = useRoute()

onMounted(()=>{
    FT()
})

const FT=()=>{
    let mid = route.query.hourseId
    axios.get("/api/User/FT",{params:{Id:mid}}).then(res=>{
        dataa.value= res.data;
    })
}

var dataa=ref({
  hourseId: 0,
  hourseName: "",
  hourseNumber: "",
  hourseStart: 0,
  userId: 0
})


const update=()=>{
    axios.post("/api/User/Update",dataa.value).then(res=>{
        if(res.data>0)
        {
            alert("修改成功");
            router.push("/Show");
        }
        else{
            alert("修改失败");
            router.push("/Show");
        }
    })
}


</script>
<style scoped>
</style>